// 以太坊环境存储器


import { defineStore } from 'pinia'
import Web3 from 'web3'

export const metaMaskMode = defineStore({
    id: 'metamask',
    state: () => {
        return {
            connect: false, //是否链接
            account: '',    //钱包账户
            chainId: "",     //链ID
            web3: {},  //web3对象
            contract: {

            },     //合约对象

        }
    },
    actions: {
        setConnect(state: boolean) {
            this.connect = state
        },
        getConnect() {
            return this.connect
        },
        setAccount(account: string) {
            this.account = account
        },
        getAccount() {
            return this.account
        },
        setChainId(chainId: any) {
            this.chainId = chainId
        },
        getChainId() {
            return this.chainId
        },
        setWeb3(web3: Web3) {
            this.web3 = web3
        },
        getWeb3() {
            return this.web3
        },


    }
}) 